<?php

class Default_NewsController extends Zend_Controller_Action
{

    public function init()
    {
        $option = array(
                'layout'=>'layout',
                'layoutPath'=>APPLICATION_PATH .'/layouts/scripts/default',
        );
        Zend_Layout::startMvc($option);
        $this->_model_news = new Application_Model_News();
    }

    public function indexAction()
    {
        // action body
    }

    public function newestAction()
    {
        $news = $this->_model_news->Get_Newest_News();
        $this->view->news = $news;
    }

    public function bestAction()
    {
        $this->view->viewest = $this->_model_news->Get_The_Viewest_of_News();
    }

    public function detailAction()
    {
        $news_id = $this->_request->getParam('newsid');
        if($news_id){
            $news_detail = $this->_model_news->Get_News_by_ID($news_id);
            $this->view->newsdetail = $news_detail;
            $this->view->headTitle("Chi tiết tin");
            $this->_model_news->Count_Number_of_News_Viewed($news_id);
            
        }
        
        
    }


}







